<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://"
			+ request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<base href="<%=basePath%>">
<link rel="stylesheet"
	href="js/jquery-easyui-1.4/themes/bootstrap/easyui.css" type="text/css"></link>
<link rel="stylesheet" href="js/jquery-easyui-1.4/themes/icon.css"
	type="text/css"></link>
<script type="text/javascript" src="js/jquery-easyui-1.4/jquery.min.js"></script>
<script type="text/javascript"
	src="js/jquery-easyui-1.4/jquery.easyui.min.js"></script>
<script type="text/javascript"
	src="js/jquery-easyui-1.4/locale/easyui-lang-zh_CN.js"></script>
<script type="text/javascript" src="js/admin.js"></script>
<script type="text/javascript" src="js/studentUI.js"></script>
<style type="text/css">
body {
	margin: 0px 0px;
}
</style>
</head>

<body>
	<!-- 工具栏 -->
	<div id="xtoolbar" style="background-color: #F5F5F5;">
		<div style="padding: 3px; float: left;">
			<input id="ss" class="easyui-searchbox" searcher="doSearch"
				prompt="请输入关键字" menu="#xsearchSelect" style="width: 300px"></input>
			<div id="xsearchSelect" style="width: 120px">
				<div name="stuId">学号</div>
				<div name="name">名字</div>
			</div>
		</div>
		<a href="javascript:void(0)" class="easyui-linkbutton"
			iconCls="icon-add" plain="true" onclick="doAdd()">新增</a> <a
			href="javascript:void(0)" class="easyui-linkbutton"
			iconCls="icon-remove" plain="true" onclick="doDelete()">删除</a> <a
			href="javascript:void(0)" class="easyui-linkbutton"
			iconCls="icon-edit" plain="true" onclick="doEdit()">修改</a>
			<a href="javascript:void(0)" class="easyui-linkbutton"
			iconCls="icon-reload" plain="true" onclick="doReload()">全局刷新</a>
	</div>

	<!-- 表格 -->
	<table id="xdatagrid">
	</table>

	<!-- 右击事件表格 -->
	<div id="xClickMenu" class="easyui-menu" style="width: 120px;">
		<div data-options="iconCls:'icon-edit'" onclick="doEdit()">修改</div>
		<div data-options="iconCls:'icon-edit'" onclick="doDelete()">删除
		</div>
		<div data-options="iconCls:'icon-reload'" onclick="doReload()">全局刷新</div>
	</div>

	<style type="text/css">
	.ftitle {
		font-size: 14px;
		font-weight: bold;
		padding: 5px 0;
		margin-bottom: 10px;
		border-bottom: 1px solid #ccc;
	}
	
	.flabel {
		font-size: 12px;
		text-align: right;;
	}
	</style>

	<!-- 新增表单 -->
	<div id="addDlg" style="padding:10px 20px;width:350px;height:250px;">
		<div class="ftitle">添加学生</div>
		<form id="addForm" method="post">
			<table width="100%">
				<tr>
					<td class="flabel">学号:</td>
					<td class="finpur"><input type="text" name="stuId"
						style="width: 200px;" class="easyui-validatebox"
						validType="length[0, 12]" required="true" />
					</td>
				</tr>
				<tr>
					<td class="flabel">名字:</td>
					<td class="finpur"><input type="text" name="name"
						style="width: 200px;" class="easyui-validatebox"
						validType="length[2, 15]" required="true" />
					</td>
				</tr>
				<tr>
					<td class="flabel">班级:</td>
					<td class="finpur">
					<select id="clazzAddCbg" name="clazzId" style="width:200px;"></select>
					</td>
				</tr>
			</table>
		</form>
	</div>

	<!-- 编辑表单 -->
	<div id="editDlg" class="easyui-dialog"
		style="padding:10px 20px;width:420px;height:250px;">
		<div class="ftitle">修改学生</div>
		<form id="editForm" method="post">
			<input type="hidden" name="id" />
			<table width="100%">
				<tr>
					<td class="flabel">学号:<span
						style="font-size: 12px; color:red;">(如不修改请勿填)</span></td>
					<td class="finpur"><input type="text" name="stuId"
						style="width: 200px;" class="easyui-validatebox"
						validType="length[1, 12]" required="true" /></td>
				</tr>
				<tr>
					<td class="flabel">名字:<span
						style="font-size: 12px; color:red;">(如不修改请勿填)</span></td>
					<td class="finpur"><input type="text" name="name"
						style="width: 200px;" class="easyui-validatebox"
						validType="length[2, 15]" required="true" /></td>
				</tr>
				<tr>
					<td class="flabel">班级:</td>
					<td class="finpur">
						<span id="clazzFullName" style="font-size:13px;"></span>
					</td>
				</tr>
				<tr>
					<td class="flabel">修改班级:<span
						style="font-size: 12px; color:red;">(如不修改请勿填)</span></td>
					<td class="finpur">
					<input id="clazzUpdateCbg" name="clazzId" style="width:200px" />
					</td>
				</tr>
			</table>
		</form>
		<div id="editButtons">
			<a href="javascript:void(0)" class="easyui-linkbutton"
				iconCls="icon-ok" onclick="javascript:$('#editForm').submit()">保存</a>
			<a href="javascript:void(0)" class="easyui-linkbutton"
				iconCls="icon-cancel"
				onclick="javascript:$('#editDlg').dialog('close')">关闭</a>
		</div>
	</div>


</body>

<script type="text/javascript">
	var dgTitle = "学生管理";
	var dgDeleteMsg = "确定要删除此学生?";
	var dgBaseUrl = "admin/student_";
	var dgDateUrl = dgBaseUrl + "list";
	var dgAddUrl = dgBaseUrl + "add";
	var dgUpdateUrl = dgBaseUrl + "update";
	var dgDeleteUrl = dgBaseUrl + "delete";
	var dgIdField = "id";
	var dgParams = {};
	var dgSortName = "stuId";
	var dgSortOrder = "asc";
	var dgColumns = [ [
			{
				field : 'id',
				formatter : function(value, rowData, rowIndex) {
					return " <input class='xid' type='checkbox' value='" + value +"'/>";
				}
			}, {
				title : '名字',
				field : 'name',
				sortable : false,
				resizable : true,
				width : 45
			}, {
				title : '学号',
				field : 'stuId',
				sortable : false,
				resizable : true,
				width : 140
			}, {
				title : '年级',
				field : 'grade',
				sortable : false,
				resizable : true,
				width : 45
			}, {
				title : '专业',
				field : 'major',
				sortable : false,
				resizable : true,
				width : 130
			}, {
				title : '班号',
				field : 'clazzNum',
				sortable : false,
				resizable : true,
				width : 45
			}, ] ];
	// 学生添加框中动态获取班级列表
	var getClazzsUrl = "admin/clazz_listAll";
	var cbgLoadData = null;
	//往edit表单load数据
	function loadDialog(row) {
	console.info(row);
		$('#editForm').form('load', {
			id : row.id,
			name : row.name,
			stuId : row.stuId,
		});
		$("#clazzFullName").html(row.grade+row.major+row.clazzNum);
		$("#editDlg").dialog('open');
	}
</script>
</html>
